import 'package:flutter/material.dart';
import 'package:flutterapp/chapter/eight/event_8_2_4_gesture_scale.dart';
import 'package:flutterapp/utils/navigator_utils.dart';

import 'event_8_2_1_gesture_click.dart';
import 'event_8_2_2_gesture_drag.dart';
import 'event_8_2_3_gesture_drag_vertical.dart';
import 'event_8_2_5_gesture_recognizer.dart';
import 'event_8_2_6_gesture_both_direction.dart';

/// @date 2020/08/06  10:32
/// @author 程志强
/// @des 手势识别

class GestureDetectorRoute extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("手势识别"),
      ),
      body: Container(
        margin: const EdgeInsets.symmetric(horizontal: 20),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: _list(context),
        ),
      ),
    );
  }

  List<Widget> _list(BuildContext context) => [
        RaisedButton(
            child: Text("点击、双击、长按"),
            onPressed: () => NavigatorUtil.goPageByPush(
                context, GestureDetectorClickRoute())),
        RaisedButton(
            child: Text("拖动、滑动(任意方向)"),
            onPressed: () =>
                NavigatorUtil.goPageByPush(context, GestureDrag())),
        RaisedButton(
            child: Text("拖动、滑动(单一方向)"),
            onPressed: () =>
                NavigatorUtil.goPageByPush(context, GestureDragVertical())),
        RaisedButton(
            child: Text("缩放"),
            onPressed: () =>
                NavigatorUtil.goPageByPush(context, GestureScale())),
        RaisedButton(
            child: Text("GestureRecognizer"),
            onPressed: () =>
                NavigatorUtil.goPageByPush(context, GestureRecognizer())),
        RaisedButton(
            child: Text("手势竞争"),
            onPressed: () =>
                NavigatorUtil.goPageByPush(context, GestureBothDirection())),
      ];
}
